/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Fragments;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicInteractions.Interaction;
import edu.pku.sei.modeler.model.uml.FundamentalActivities.Action;

import edu.pku.sei.modeler.model.uml.BasicInteractions.InteractionFragment;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class InteractionUse extends InteractionFragment implements IInteractionUse {
	// attributes
	
	protected Interaction refersTo;
	
	
	
	
	// references
	
	protected MetaTypedList actualGate;
	
	protected MetaTypedList argument;
	
	
	
	// getters & setters for attributes
	
	public Interaction getRefersTo() {
		return refersTo;
	}
	public void setRefersTo(Interaction newRefersTo) {
		Interaction oldrefersTo = refersTo;
		refersTo = newRefersTo;
		firePropertyChange(ModelPackage.INTERACTIONUSE_REFERSTO, oldrefersTo, newRefersTo);
	}
	
	// getters for references
	
	public MetaTypedList getActualGate() {
		if(actualGate == null) {
			actualGate = new MetaTypedList(Gate.class, this, ModelPackage.INTERACTIONUSE_ACTUALGATE);
		}
		return actualGate;
	}
	
	public MetaTypedList getArgument() {
		if(argument == null) {
			argument = new MetaTypedList(Action.class, this, ModelPackage.INTERACTIONUSE_ARGUMENT);
		}
		return argument;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.INTERACTIONUSE_REFERSTO, refersTo);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INTERACTIONUSE_ACTUALGATE, actualGate);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INTERACTIONUSE_ARGUMENT, argument);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		refersTo = (Interaction)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.INTERACTIONUSE_REFERSTO, this);
		
		// references
		
		this.getActualGate().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INTERACTIONUSE_ACTUALGATE));
		
		this.getArgument().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INTERACTIONUSE_ARGUMENT));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.INTERACTIONUSE_REFERSTO.equals(featureID)) {
			refersTo = (Interaction)value;
		}
		
		// references
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 